Skip to content

add CStr::display #139994

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 29, 2025
Merged

add CStr::display #139994

merged 1 commit into from
May 29, 2025

Conversation

tamird
Copy link
Contributor

@tamird tamird commented Apr 17, 2025

The implementation delegates to <ByteStr as Display>::fmt.

Link: rust-lang/libs-team#550
Link: #139984.

r? @BurntSushi
cc @Darksonn @tgross35 @ojeda @joshtriplett

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Apr 17, 2025
@tgross35
Copy link
Contributor

tgross35 commented Apr 18, 2025

Could you add a doc comments clarifying what this does for escaping?

Since this requires FCP:
@rustbot label +I-libs-api-nominated

@rustbot rustbot added the I-libs-api-nominated Nominated for discussion during a libs-api team meeting. label Apr 18, 2025
@tgross35 tgross35 added needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. and removed I-libs-api-nominated Nominated for discussion during a libs-api team meeting. labels Apr 18, 2025
Copy link
Contributor Author

@tamird tamird left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a doc comments clarifying what this does for escaping?

Done.

ChrisDenton added a commit to ChrisDenton/rust that referenced this pull request Apr 21, 2025
{B,C}Str: minor cleanup

(hopefully) uncontroversial bits extracted from rust-lang#139994.
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Apr 21, 2025
Rollup merge of rust-lang#140118 - tamird:cstr-cleanup, r=joboet

{B,C}Str: minor cleanup

(hopefully) uncontroversial bits extracted from rust-lang#139994.
@bors
Copy link
Collaborator

bors commented Apr 21, 2025

☔ The latest upstream changes (presumably #140127) made this pull request unmergeable. Please resolve the merge conflicts.

@tgross35 tgross35 added the I-libs-api-nominated Nominated for discussion during a libs-api team meeting. label Apr 21, 2025
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this pull request Apr 23, 2025
{B,C}Str: minor cleanup

(hopefully) uncontroversial bits extracted from rust-lang#139994.
@Amanieu
Copy link
Member

Amanieu commented Apr 29, 2025

In rust-lang/libs-team#550 the @rust-lang/libs-api team decided against implementing Display for CStr in favor of adding a display method like on OsStr and Path.

@Amanieu Amanieu removed the I-libs-api-nominated Nominated for discussion during a libs-api team meeting. label Apr 29, 2025
@tamird
Copy link
Contributor Author

tamird commented Apr 29, 2025

Shall I rework this? Can I use impl fmt::Display in the implementation, or does it need to be a nameable type?

@Amanieu
Copy link
Member

Amanieu commented May 3, 2025

Yes, it's fine to rework this to return impl fmt::Display. Also a tracking issue should be created for this.

@tamird tamird changed the title impl Display for CStr{,ing} add CStr::display May 24, 2025
@tamird
Copy link
Contributor Author

tamird commented May 24, 2025

@Amanieu updated the implementation and reopened #139984 as the tracking issue.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

The implementation delegates to `<ByteStr as Display>::fmt`.

Link: rust-lang/libs-team#550
Link: rust-lang#139984.
@Amanieu
Copy link
Member

Amanieu commented May 28, 2025

@bors r+

@bors
Copy link
Collaborator

bors commented May 28, 2025

📌 Commit 947be5f has been approved by Amanieu

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 28, 2025
tgross35 added a commit to tgross35/rust that referenced this pull request May 28, 2025
add `CStr::display`

The implementation delegates to `<ByteStr as Display>::fmt`.

Link: rust-lang/libs-team#550
Link: rust-lang#139984.

r? `@BurntSushi`
cc `@Darksonn` `@tgross35` `@ojeda` `@joshtriplett`
bors added a commit that referenced this pull request May 28, 2025
Rollup of 7 pull requests

Successful merges:

 - #125087 (Optimize `Seek::stream_len` impl for `File`)
 - #133823 (Use `cfg_attr_trace` in AST with a placeholder attribute for accurate suggestion)
 - #138285 (Stabilize `repr128`)
 - #139994 (add `CStr::display`)
 - #141477 (Path::with_extension: show that it adds an extension where one did no…)
 - #141533 (clean up old rintf leftovers)
 - #141693 (Subtree update of `rust-analyzer`)

r? `@ghost`
`@rustbot` modify labels: rollup
tgross35 added a commit to tgross35/rust that referenced this pull request May 28, 2025
add `CStr::display`

The implementation delegates to `<ByteStr as Display>::fmt`.

Link: rust-lang/libs-team#550
Link: rust-lang#139984.

r? ``@BurntSushi``
cc ``@Darksonn`` ``@tgross35`` ``@ojeda`` ``@joshtriplett``
bors added a commit that referenced this pull request May 28, 2025
Rollup of 8 pull requests

Successful merges:

 - #125087 (Optimize `Seek::stream_len` impl for `File`)
 - #138285 (Stabilize `repr128`)
 - #139994 (add `CStr::display`)
 - #141477 (Path::with_extension: show that it adds an extension where one did no…)
 - #141533 (clean up old rintf leftovers)
 - #141690 (Add `rustc_diagnostic_item` to `sys::Mutex` methods)
 - #141693 (Subtree update of `rust-analyzer`)
 - #141702 (Add eholk to compiler reviewer rotation)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request May 29, 2025
Rollup of 4 pull requests

Successful merges:

 - #138285 (Stabilize `repr128`)
 - #139994 (add `CStr::display`)
 - #141571 (coretests: extend and simplify float tests)
 - #141656 (CI: Add cargo tests to aarch64-apple-darwin)

Failed merges:

 - #141430 (remove `visit_clobber` and move `DummyAstNode` to `rustc_expand`)
 - #141636 (avoid some usages of `&mut P<T>` in AST visitors)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit ba042d7 into rust-lang:master May 29, 2025
6 checks passed
@rustbot rustbot added this to the 1.89.0 milestone May 29, 2025
rust-timer added a commit that referenced this pull request May 29, 2025
Rollup merge of #139994 - tamird:cstr-display, r=Amanieu

add `CStr::display`

The implementation delegates to `<ByteStr as Display>::fmt`.

Link: rust-lang/libs-team#550
Link: #139984.

r? ```@BurntSushi```
cc ```@Darksonn``` ```@tgross35``` ```@ojeda``` ```@joshtriplett```
@tamird tamird deleted the cstr-display branch May 29, 2025 12:09
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this pull request May 30, 2025
add `CStr::display`

The implementation delegates to `<ByteStr as Display>::fmt`.

Link: rust-lang/libs-team#550
Link: rust-lang#139984.

r? ```@BurntSushi```
cc ```@Darksonn``` ```@tgross35``` ```@ojeda``` ```@joshtriplett```
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this pull request May 30, 2025
Rollup of 4 pull requests

Successful merges:

 - rust-lang#138285 (Stabilize `repr128`)
 - rust-lang#139994 (add `CStr::display`)
 - rust-lang#141571 (coretests: extend and simplify float tests)
 - rust-lang#141656 (CI: Add cargo tests to aarch64-apple-darwin)

Failed merges:

 - rust-lang#141430 (remove `visit_clobber` and move `DummyAstNode` to `rustc_expand`)
 - rust-lang#141636 (avoid some usages of `&mut P<T>` in AST visitors)

r? `@ghost`
`@rustbot` modify labels: rollup
flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request May 31, 2025
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#138285 (Stabilize `repr128`)
 - rust-lang/rust#139994 (add `CStr::display`)
 - rust-lang/rust#141571 (coretests: extend and simplify float tests)
 - rust-lang/rust#141656 (CI: Add cargo tests to aarch64-apple-darwin)

Failed merges:

 - rust-lang/rust#141430 (remove `visit_clobber` and move `DummyAstNode` to `rustc_expand`)
 - rust-lang/rust#141636 (avoid some usages of `&mut P<T>` in AST visitors)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants